<template>
  <div class="">
    <el-dialog title="下发详情" :visible.sync="dialogVisible" width="60%">
      <el-row :gutter="20">
        <el-col :span="6" class="font16">姓名：{{ isData.name }}</el-col>
        <el-col :span="6" class="font16">学号：{{ isData.no }}</el-col>
      </el-row>
      <div class="up-table">
        <QueryTable
          :tableConfiguration="tableConfiguration"
          :displayContent="displayContent"
          :formData="formData"
          :isPop="true"
          ref="queryTable"
          :api="getTableServe"
        >
          <template v-slot:sync="{ scope }">
            {{ scope.row.sync ? '下发到权限组且成功下发' : '下发到权限组但未下发' }}
          </template>
        </QueryTable>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="danger" @click="dialogVisible = false">重新下发</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import QueryTable from '@/components/queryTable/index.vue';

import { usersyncinfo } from '@/api/comment/UserList.js';

export default {
  components: {
    QueryTable
  },
  data() {
    return {
      dialogVisible: false,
      getTableServe: usersyncinfo,

      //配置文件
      displayContent: {
        height: '40vh',
        indexFixed: true,
        selectionFixed: true,
        selection: false,
        index: true,
        paginationShow: true
      },
      formData: {}, //传给后端的参数
      tableConfiguration: [
        {
          prop: 'name',
          label: '所属权限组',
          width: '360',
          align: 'center'
        },
        // {
        //   prop: 'no',
        //   label: '设备',
        //   width: '260',
        //   align: 'center'
        // },
        // {
        //   prop: 'merge_name',
        //   label: '权限类型',
        //   width: '260',
        //   align: 'center'
        // },
        // {
        //   prop: 'devices',
        //   label: '权限下发时间',
        //   width: '260',
        //   align: 'center'
        // },
        {
          prop: 'sync',
          label: '权限下发结果',
          width: '360',
          align: 'center',
          sockets: true
        }
      ],

      isData: {} //所有数据
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    //打开弹窗
    open(data) {
      this.dialogVisible = true; //打开弹窗
      this.isData = data;
      this.formData.no = data.no; //学工号
      this.$nextTick(() => {
        this.$refs.queryTable.handleCurrentChange(1);
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.font16 {
  font-size: 16px;
}

.up-table {
  margin-top: 20px;
}
</style>
